package com.example.android.BluetoothChat;

public class RtnDataStream {
	private static final String DELIT = "##__##";
	private String[] datas;
	private int idx = 0;
	
	public RtnDataStream(String rawRtn)			{
		process(rawRtn);
	}

	private void process(String rawRtn) {
		rawRtn = rawRtn.replace("\\r", "\r");
		datas = rawRtn.split("[\\s]*"+DELIT+"[\\s]*");
		for(int i = 0; i < datas.length; ++i)		{
			datas[i] = datas[i].trim();
		}
	}

	@Override
	public String toString() {
		String tmp = datas[idx];
		idx = ++idx % datas.length;
		return tmp;
	}
	
}
